var app = getApp(), $ = require("../../utils/util.js"), api = require("../../utils/api.js"),
  notice = require("../../utils/notice"),init = true;
Page({
  data: {
    show: !0,
  },
  onLoad: function (e) {
    var t = this
    // 打开分享设置
    $.showmenu()
    $.isAuth() ? t.refreshUser() : (notice.addNotification("refreshUser", t.refreshUser, t))
  },
  onShow: function (e) {
    var t = this
    !init && t.refreshUser() ? 0 : 0
    init = false
    $.isAuth() ? t.setData({show: !1}) : t.setData({show: !0})
  },
  refreshUser() {
    var t = this
    $.post(api.userinfo, {
      feilds: "cardno,phone,is_member isMember,is_mch isMch,is_platform isPlatform,is_agent isAgent,is_admin isAdmin,member_level memberLevel,sid",
      extra: "jifen,token,xnbi,zhekou,chargeAmount,mtype,store"
    }, function (e) {
      wx.setStorageSync('nickName', e.info.nickName)
      wx.setStorageSync('avatarUrl', e.info.avatarPic)
    })
  }
})
